package seckill;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @author 帅小伙
 * @date 2021/12/31
 * @description
 */
public class JedisPoolUtil {


    private static  volatile JedisPool jedisPool = null;

    private JedisPoolUtil(){ }


    public static JedisPool getJedisPoolInstance(){
        if(jedisPool == null){
            synchronized(JedisPoolUtil.class){
                if(null == jedisPool){
                    JedisPoolConfig config = new JedisPoolConfig();
                    config.setMaxIdle(200);
                    config.setMaxIdle(32);
                    config.setMaxWaitMillis(10*1000);
                    config.setBlockWhenExhausted(true);
                    config.setTestOnBorrow(true);

                    jedisPool = new JedisPool(config,"47.96.19.90", 23333,6*1000);
                }
            }
        }

        return jedisPool;
    }






}
